﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TreeSharp;

namespace FelMaster.Classes.Hunter
{
    class BeastMastery : TalentBase
    {
        public override string Name
        {
            get { return "Beast Mastery By d4rk99"; }
        }

        public override string KeySpell
        {
            get { return "Intimidation"; }
        }

        public override Composite SingleRotation
        {
            get
            {
                return new PrioritySelector(
                    SC.CastUniqueSpell("Call Pet 1", a => (Pet == null), "Calling Pet"),
                    SC.CastUniqueSpell("Revive Pet", a => (Pet == null || Pet.Dead), "Revive Pet"),
                    SC.CastDebuff("Hunter's Mark", a => true, "Hunter's Mark"),
                    //SC.UseBagItem("Potion of the Tol'vir", a => SC.PlayerHasBuff("Bloodlust") || SC.PlayerHasBuff("Heroism"), "Golemblood Potion"),
                    SC.CastBuff("Aspect of the Fox", a => Me.IsMoving, "Aspect of the Fox while moving"),
                    SC.CastSpell("Serpent Sting", a => Me.IsMoving && SC.PlayerHasBuff("Aspect of the Fox"), "Serpent Sting while moving"),
                    SC.CastSpell("Kill Shot", a => Me.IsMoving && SC.PlayerHasBuff("Aspect of the Fox"), "Kill Shot while moving"),
                    SC.CastSpell("Kill Command", a => Me.IsMoving && SC.PlayerHasBuff("Aspect of the Fox"), "Kill Command while moving"),
                    SC.CastSpell("Arcane Shot", a => Me.FocusPercent >= 52 && Me.IsMoving && SC.PlayerHasBuff("Aspect of the Fox"), "Arcane Shot while moving"),
                    SC.RunMacroText("/Cast Cobra Shot", a => Me.IsMoving && SC.PlayerHasBuff("Aspect of the Fox"), "Cobra Shot while moving"),
                    SC.CastBuff("Aspect of the Hawk", a => !Me.IsMoving, "Aspect of the Hawk"),
                    SC.CastBuff("Trap Launcher", a => SC.CanCast("Explosive Trap"), "Trap Launcher"),
                    SC.CastAreaSpell("Explosive Trap", 2, true, 1, 0.0, 40.0, a => SC.PlayerHasBuff("Trap Launcher"), "Explosive Trap"),
                    SC.CastBuff("Bestial Wrath", a => Me.FocusPercent > 60, "Bestial Wrath"),
                    SC.CastDebuff("Serpent Sting", a => true, "Serpent Sting"),
                    SC.CastSpell("Kill Shot", a => true, "Kill Shot"),
                    SC.CastBuff("Rapid Fire", a => SC.PlayerHasBuff("The Beast Within"), "Rapid Fire"),
                    SC.CastSpell("Kill Command", a => true, "Kill Command"),
                    SC.CastSpell("Fervor", a => Me.FocusPercent <= 20, "Fervor"),
                    SC.CastBuff("Focus Fire", a => Me.Pet.HasAura("Frenzy Effect"), "Focus Fire"),
                    SC.CastSpell("Arcane Shot", a => Me.FocusPercent >= 52, "Arcane Shot"),
                    SC.CastSpell("Cobra Shot", a => true, "Cobra Shot")
                );
            }
        }

        public override Composite Buffs
        {
            get
            {
                return new PrioritySelector(
                    SC.CastUniqueSpell("Call Pet 1", a => (Pet == null), "Calling Pet"),
                    SC.CastUniqueSpell("Revive Pet", a => (Pet == null || Pet.Dead), "Revive Pet")
                );
            }
        }

        public override Composite PVPRotation
        {
            get
            {
                return new PrioritySelector(
                    SC.CastDebuff("Hunter's Mark", a => true, "Hunter's Mark"),
                    SC.CastBuff("Aspect of the Fox", a => true, "Aspect of the Fox"),
                    SC.CastBuff("Bestial Wrath", a => Me.FocusPercent > 60, "Bestial Wrath"),
                    SC.CastSpell("Intimidation", a => SC.PlayerHasBuff("The Beast Within"), "Intimidation"),
                    SC.CastDebuff("Concussive Shot", a => !SC.TargetHasDebuff("Intimidation"), "Concussive Shot"),
                    SC.CastBuff("Trap Launcher", a => SC.CanCast("Ice Trap"), "Trap Launcher"),
                    SC.CastAreaSpell("Ice Trap", 2, true, 1, 0.0, 40.0, a => SC.PlayerHasBuff("Trap Launcher"), "Ice Trap"),
                    SC.CastDebuff("Serpent Sting", a => true, "Serpent Sting"),
                    SC.CastSpell("Kill Shot", a => true, "Kill Shot"),
                    SC.CastBuff("Rapid Fire", a => SC.PlayerHasBuff("The Beast Within"), "Rapid Fire"),
                    SC.CastSpell("Kill Command", a => true, "Kill Command"),
                    SC.CastSpell("Fervor", a => Me.FocusPercent <= 20, "Fervor"),
                    SC.CastBuff("Focus Fire", a => Me.Pet.HasAura("Frenzy Effect"), "Focus Fire"),
                    SC.CastSpell("Arcane Shot", a => Me.FocusPercent >= 52, "Arcane Shot"),
                    SC.CastSpell("Cobra Shot", a => true, "Cobra Shot")
                );
            }
        }

        public override Composite PVERotation
        {
            get
            {
                return SingleRotation;
            }
        }
    }
}
